package com.xquant.system.api.factory;

import com.xquant.system.api.RemoteDailyPriceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author cloud
 * @version 1.0
 * @description:
 * @date 2022/4/21 14:33
 */
@Component
public class RemoteDailyPriceFallbackFactory implements FallbackFactory<RemoteDailyPriceService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDailyPriceService.class);


    @Override
    public RemoteDailyPriceService create(Throwable cause) {
        log.error("调用每日价格失败"+cause.getMessage());
        return new RemoteDailyPriceService() {
            @Override
            public Map getDailyPriceService(Map<String, Object> param) {
                Map map = new HashMap();
                map.put("error","调用每日价格失败"+cause.getMessage());
                return map;
            }

            @Override
            public Map getdailypriceByBegDate(Map<String, Object> param) {
                Map map = new HashMap();
                map.put("error","调用起始日期价格失败"+cause.getMessage());
                return map;
            }
        };
    }


}
